<%
    String files[] ={"monkey.jpg","05.jpg","06.jpg","07.jpg"};
    String id =request.getParameter("id");
    String filename="C:/Users/Benny/Documents/web/images/monkey.jpg";
    if(id !=null)
        filename ="C:/Users/Benny/Documents/web/images/" + files[Integer.parseInt(id)];
    System.out.println(application.getMimeType(filename));
    response.setContentType(application.getMimeType(filename));
     java.io.OutputStream os =response.getOutputStream();
    java.io.FileInputStream is =new java.io.FileInputStream(filename);
    
    int byteread=0;
    while((byteread=is.read())!=-1){
        os.write(byteread);
    }
    is.close();
    os.flush();
%>